{% extends "users/base_site.html" %}
{% load i18n static %}

{% block extrastyle %}{{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}">
    <style>
        #id_password1, #id_password2, #id_email{
            clear: both;
            padding: 8px;
            width: 100%;
            box-sizing: border-box;
        }
    </style>

{{ form.media }}
{% endblock %}

{% block bodyclass %}{{ block.super }} login{% endblock %}

{% block usertools %}{% endblock %}

{% block nav-global %}{% endblock %}

{% block nav-sidebar %}{% endblock %}

{% block content_title %}{% endblock %}

{% block breadcrumbs %}{% endblock %}

{% block content %}
{% if form.errors and not form.non_field_errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %}
</p>
{% endif %}

{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<p class="errornote">
    {{ error }}
</p>
{% endfor %}
{% endif %}

<div id="content-main">

{% if user.is_authenticated %}
<p class="errornote">
{% blocktranslate trimmed %}
    You are authenticated as {{ username }}, but are not authorized to
    access this page. Would you like to login to a different account?
{% endblocktranslate %}
</p>
{% endif %}

<form action="{{ app_path }}" method="post" id="register-form">{% csrf_token %}
  <div class="form-row">
    {{ form.username.errors }}
    {{ form.username.label_tag }} {{ form.username }}
  </div>
  <div class="form-row">
    {{ form.password1.errors }}
    {{ form.password1.label_tag }} {{ form.password1 }}
    <input type="hidden" name="next" value="{{ next }}">
  </div>
    <div class="form-row">
        {{ form.password2.errors }}
        {{ form.password2.label_tag }} {{ form.password2 }}
        <input type="hidden" name="next" value="{{ next }}">
    </div>
    <div class="form-row">
        {{ form.email.errors }}
        {{ form.email.label_tag }} {{ form.email }}
        <input type="hidden" name="next" value="{{ next }}">
    </div>
  {% url 'users:login' as register_url %}
  {% if register_url %}
    <div class="password-reset-link">
       <a href="{{ register_url }}">{% translate '已经有账号, 现在去登陆?' %}</a>
    </div>
  {% endif %}
  <div class="submit-row">
    <input type="submit" value="{% translate 'Sign in' %}">
  </div>
</form>

</div>
{% endblock %}
